load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("//pkg/testutils:buildutil/buildutil.bzl", "disallowed_imports_test")

go_library(
    name = "tabledesc",
    srcs = [
        "column.go",
        "constraint.go",
        "index.go",
        "mutation.go",
        "safe_format.go",
        "structured.go",
        "table.go",
        "table_desc.go",
        "table_desc_builder.go",
        "ttl.go",
        "validate.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/clusterversion",
        "//pkg/docs",
        "//pkg/geo/geopb",
        "//pkg/jobs/jobspb",
        "//pkg/keys",
        "//pkg/roachpb",
        "//pkg/security/username",
        "//pkg/settings",
        "//pkg/sql/catalog",
        "//pkg/sql/catalog/catenumpb",
        "//pkg/sql/catalog/catpb",
        "//pkg/sql/catalog/catprivilege",
        "//pkg/sql/catalog/colinfo",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/fetchpb",
        "//pkg/sql/catalog/funcdesc",
        "//pkg/sql/catalog/internal/validate",
        "//pkg/sql/catalog/multiregion",
        "//pkg/sql/catalog/schemaexpr",
        "//pkg/sql/catalog/seqexpr",
        "//pkg/sql/catalog/typedesc",
        "//pkg/sql/lexbase",
        "//pkg/sql/parser",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/pgwire/pgnotice",
        "//pkg/sql/privilege",
        "//pkg/sql/rowenc",
        "//pkg/sql/schemachanger/scpb",
        "//pkg/sql/sem/catconstants",
        "//pkg/sql/sem/catid",
        "//pkg/sql/sem/eval",
        "//pkg/sql/sem/semenumpb",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sem/volatility",
        "//pkg/sql/sqlerrors",
        "//pkg/sql/types",
        "//pkg/util",
        "//pkg/util/errorutil/unimplemented",
        "//pkg/util/hlc",
        "//pkg/util/interval",
        "//pkg/util/intsets",
        "//pkg/util/iterutil",
        "//pkg/util/protoutil",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_redact//:redact",
        "@com_github_lib_pq//oid",
        "@com_github_robfig_cron_v3//:cron",
    ],
)

go_test(
    name = "tabledesc_test",
    size = "small",
    srcs = [
        "constraint_test.go",
        "helpers_test.go",
        "index_test.go",
        "main_test.go",
        "safe_format_test.go",
        "structured_test.go",
        "table_desc_builder_test.go",
        "table_desc_test.go",
        "validate_test.go",
        "validate_version_gating_test.go",
    ],
    embed = [":tabledesc"],
    deps = [
        "//pkg/base",
        "//pkg/clusterversion",
        "//pkg/geo/geopb",
        "//pkg/jobs",
        "//pkg/jobs/jobspb",
        "//pkg/keys",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/security/username",
        "//pkg/server",
        "//pkg/sql",
        "//pkg/sql/catalog",
        "//pkg/sql/catalog/bootstrap",
        "//pkg/sql/catalog/catalogkeys",
        "//pkg/sql/catalog/catenumpb",
        "//pkg/sql/catalog/catpb",
        "//pkg/sql/catalog/dbdesc",
        "//pkg/sql/catalog/descbuilder",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/desctestutils",
        "//pkg/sql/catalog/funcdesc",
        "//pkg/sql/catalog/internal/validate",
        "//pkg/sql/catalog/nstree",
        "//pkg/sql/catalog/systemschema",
        "//pkg/sql/privilege",
        "//pkg/sql/schemachanger/scpb",
        "//pkg/sql/sem/catconstants",
        "//pkg/sql/sem/catid",
        "//pkg/sql/sem/semenumpb",
        "//pkg/sql/types",
        "//pkg/testutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/sqlutils",
        "//pkg/util/hlc",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/protoutil",
        "//pkg/util/randutil",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_redact//:redact",
        "@com_github_kr_pretty//:pretty",
        "@com_github_stretchr_testify//require",
        "@in_gopkg_yaml_v2//:yaml_v2",
        "@org_golang_google_protobuf//proto",
    ],
)

disallowed_imports_test(
    "tabledesc",
    disallowed_list = [
        "//pkg/sql/sem/builtins",
    ],
)
